import request from "@/libs/request";

const basePath = '/appcloud-data' ;
const basePathResource = '/appcloud-resource' ;

export const apiUrls = {
	getCluster : basePath + '/api/cluster/getCluster',
	getClusterInfo : basePath + '/api/cluster/getClusterInfo/',
	getClusterList : basePath + '/api/cluster/getClusterList' ,
	getClusterMasterNode : basePath + '/api/cluster/getClusterMasterNode' ,
	remove : basePath + '/api/cluster/remove/' ,
	save : basePath + '/api/cluster/save' ,
}

export const apiUrlsResource = {
	deleteHost : basePathResource + '/api/resource/host/delete',
}

// 删除主机
export async function deleteHost(params){
	return request( apiUrlsResource.deleteHost + `?ip=${params.ip}` , {
      method:'POST',
      //body:params
  })
}

// 查询所有集群信息
export async function getCluster(params){
	return request( apiUrls.getCluster , {
      method:'GET',
      body:params
  })
}

// 获取集群详情
export async function getClusterInfo(params){
	return request( apiUrls.getClusterInfo + `${params.id}` , {
      method:'POST',
      body:params
  })
}

// 获取集群列表
export async function getClusterList(params){
	return request( apiUrls.getClusterList , {
      method:'POST',
      body:params
  })
}

// 根据集群id获取主节点信息
export async function getClusterMasterNode(params){
	return request( apiUrls.getClusterMasterNode , {
      method:'POST',
      body:params
  })
}

// 删除集群
export async function remove(params){
	return request( apiUrls.remove + `${params.id}` , {
      method:'POST',
      body:params
  })
}

// 保存集群
export async function save(params){
	return request( apiUrls.save , {
      method:'POST',
      body:params
  })
}

